/**
 * @author wn
 * @date 2023/09/15 11:32:11
 * @description: 登陆 API 接口
 */

import { request } from '@/utils/request'

enum Url {
	WX = '/login/wxMin',
	Account = '/login',
	PhoneTest = '/login/wxMin/simple',
}

/**
 * 登陆--微信登陆 后台 API
 * @param data : LoginWxMinParams
 * @returns Promise
 */
export const wxLoginApi = (data: LoginWxMinParams) =>
	request<LoginResult>({
		method: 'POST',
		url: Url.WX,
		data,
	})

/**
 * 传统登录--用户名+密码
 * @param data : 账号密码
 * @returns Promise
 */
export const accountLoginApi = (data: LoginParams) =>
	request<LoginResult>({
		method: 'POST',
		url: Url.Account,
		data,
	})

/**
 * 快捷登录--手机号
 * @param phone : 手机号
 * @returns Promise
 */
export const phoneTestLoginApi = (phoneNumber: string) =>
	request<LoginResult>({
		method: 'POST',
		url: Url.PhoneTest,
		data: { phoneNumber },
	})
